package com.dhl.order.client;

import com.dhl.order.common.DecreaseStockInput;
import com.dhl.order.common.ProductInfoOutput;
import com.dhl.order.dto.CartDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

//注明是哪个应用的接口
@FeignClient(name = "product")
@Component
public interface ProductClient {

    @GetMapping("/msg")
    String productMsg();

    @PostMapping("/product/listForOrder")
    List<ProductInfoOutput> listForOrder(@RequestBody List<String> productIdList);

    @PostMapping("/product/listForOrder2")
    List<ProductInfoOutput> listForOrder2(@RequestBody List<String> productIdList);


    @PostMapping("/product/decreaseStock")
    void decreaseStock(@RequestBody List<CartDTO> cartDTOList);

    //扣库存
    @PostMapping("/product/decreaseStock")
    void decreaseStock2(@RequestBody List<DecreaseStockInput> cartDTOList);
}
